// Elasticsearch
resource "huaweicloud_css_cluster" "this" {
  count = var.css_create ? 1: 0

  expect_node_num = var.css_expect_node_num
  name            = var.css_name
  engine_version  = var.css_engine_version

  node_config {
    flavor            = var.css_flavor
    availability_zone = data.huaweicloud_availability_zones.this.names[0]

    network_info {
      security_group_id = huaweicloud_networking_secgroup.this.id
      subnet_id         = huaweicloud_vpc_subnet.this.0.id
      vpc_id            = huaweicloud_vpc.this.id
    }

    volume {
      volume_type = var.css_volume_type
      size        = var.css_volume_size
    }
  }

  #enterprise_project_id = var.enterprise_project_id
  depends_on = [huaweicloud_vpc_subnet.this]
}
